package cn.edu.xjtu.android.emoji_warfare_android.game.item;

import android.graphics.Canvas;
import cn.edu.xjtu.android.emoji_warfare_android.engine.Item;
import cn.edu.xjtu.android.emoji_warfare_android.engine.ScreenBoundary;
import cn.edu.xjtu.android.emoji_warfare_android.game.Config;

/**
 * 可捡拾武器
 * 
 * @author bill
 *
 */
public class WeaponItem extends Item {
    private int index;
    private static float half;

    public WeaponItem(float birthX, float birthY, ScreenBoundary boundary, int imageIndex) {
        super(birthX, birthY, Config.Item.outline, boundary);
        index = imageIndex;
        this.randomDirect(Config.Item.speed);
    }

    public int getWeapon() {
        return index + 1;
    }

    @Override
    public boolean onDraw(Canvas canvas) {
        canvas.drawBitmap(Config.Item.image[index], -half, -half, Config.Common.bitmapPaint);
        return false;
    }

    static {
        half = Config.Item.len / 2.0f;
    }

}
